/*package com.util.oss;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kyhd.storm.util.AppConfig;
import com.kyhd.storm.util.DateUtil;
import com.kyhd.storm.util.UploadOSS;

@Service
public class OSSService {
	
	@Autowired(required=true)
	AppConfig appConfig;
	
	*//** 将url路径格式的图片上传到OSS服务器上，并返回OSS路径，灵异网站|女人街|下书网
	 * @param imgurl   url路径
	 * @return
	 *//*
	public String uploadImageURL(String imgurl, String uuid, boolean cover,String suf,String mk) {
		BufferedInputStream bis = null;
		try {
			URL url = new URL(imgurl.toString());
			URLConnection urlconnection = url.openConnection();
			bis = new BufferedInputStream(urlconnection.getInputStream());
			String prefix = "";
			if(cover) {
				prefix ="toutiao/picture/cover/";//封面
			}else {
				if(suf!=null) {
					prefix = "toutiao/picture/"+mk+"/"+suf+"/";//图片
				}else {
					prefix = "toutiao/picture/"+mk+"/";//图片
				}
			}
			String fileName = this.createImgName(suf,uuid);
			String path = UploadOSS.uploadCommon(bis,prefix,fileName, 
					appConfig.getEndPoint(), appConfig.getAccessKeyId(), appConfig.getAccessKeySecret(), appConfig.getBucketName());
			return path;
		} catch (IOException e) {
			e.printStackTrace();
			return "";
		} finally {
			try {
				if (bis != null)
					bis.close();
			} catch (IOException e) {
			}
		}
	}
	*//**
	 * 根据uuid生成头像后缀名
	 * @param uuid
	 * @return
	 *//*
	public String createImgName(String suf, String uuid) {
		String fileName = suf + DateUtil.formatString(new Date(), "MMddHH") + uuid + ".jpg";
		return fileName;
	}
	
//---------------------用户头像-----------------------------------------//
	*//**
	 * 上传图片到阿里云OSS服务器,
	 * @param prefixPath
	 * @param strdate
	 *//*
	public String uploadCommon(InputStream inputStream, String fileName) {
		
		String path = UploadOSS.uploadCommon(inputStream, fileName,
				appConfig.getUserEndpoint(), appConfig.getUserAccessKeyId(), appConfig.getUserAccessKeySecret(), appConfig.getUserBucketName());
		
		return  path;
	}
	
	*//**
	 * 将url路径格式的图片上传到OSS服务器上，并返回OSS路径  用户头像
	 * @param imgurl   url路径
	 * @return
	 *//*
	public String uploadImageURL(String imgurl, String uuid) {
		BufferedInputStream bis = null;
		try {
			URL url = new URL(imgurl.toString());
			URLConnection urlconnection = url.openConnection();
			bis = new BufferedInputStream(urlconnection.getInputStream());
			
			String fileName = this.createImgName(uuid);
			String path = UploadOSS.uploadCommon(bis, fileName, 
					appConfig.getUserEndpoint(), appConfig.getUserAccessKeyId(), appConfig.getUserAccessKeySecret(), appConfig.getUserBucketName());
			return path;
		} catch (IOException e) {
			e.printStackTrace();
			return imgurl;
		} finally {
			try {
				if (bis != null)
					bis.close();
			} catch (IOException e) {
			}
		}
	}
	
	*//**
	 * 根据uuid生成头像后缀名
	 * @param uuid
	 * @return
	 *//*
	public String createImgName(String uuid) {
		String fileName = DateUtil.formatString(new Date(), DateUtil.YMD + DateUtil.FHMS_N) + uuid + ".jpg";
		return fileName;
	}
	
}
*/